package org.zcl.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.zcl.entity.User;
import org.zcl.feign.hystrix.HystrixClientFallbackFactory;

/**
 * @author: ZCL
 * @since: 2021/10/15 14:02
 */
@FeignClient(name = "spring-boot-user", fallbackFactory = HystrixClientFallbackFactory.class)
public interface UserFeignClient {

    // 两个坑：1. @GetMapping不支持   2. @PathVariable得设置value
    @RequestMapping(value = "/simple/{id}", method = RequestMethod.GET)
    User findById(@PathVariable("id") Long id);
}
